package dse.messages.singleversion;

import dse.DataObject;
import dse.ExperimentRecorder;
import dse.Node;

public interface ShareDownloader {
	void shareDownloaded (
			ExperimentRecorder recorder,
			Node from,
			DataObject dobj, 
			int shareIndex,
			double timeLeft
			);
	/**
	 * When the share could not be downloaded because the inital get share local
	 * request message failed, because the requesting node has recieved a
	 * failure message from one of the local nodes it contacted, or because
	 * the requesting node could not successfully download a share after being
	 * redirected to the actual location of the share from the local nodes. 
	 * 
	 * @param recorder
	 * @param dobj
	 * @param shareIndex
	 * @param timeLeft
	 */
	void shareDownloadFailed (
			ExperimentRecorder recorder, 
			DataObject dobj, 
			int shareIndex,
			double timeLeft
			);
	/**
	 * Whether or not the share downloader has already finished.
	 * 
	 * @return
	 */
	boolean isDoneDownloadingShares ();
	
	void shareUpdated (
			ExperimentRecorder recorder,
			Node to,
			DataObject dobj, 
			int shareIndex,
			double timeLeft
			);
	/**
	 * When the share could not be updated because the initial share update
	 * message failed, because the requesting node has received a
	 * failure message. 
	 * 
	 * @param recorder
	 * @param dobj
	 * @param shareIndex
	 * @param timeLeft
	 */
	void shareUpdateFailed (
			ExperimentRecorder recorder, 
			DataObject dobj, 
			int shareIndex,
			double timeLeft
			);
	/**
	 * Whether or not the share updater has already finished.
	 * 
	 * @return
	 */
	boolean isDoneUpdatingShares ();
}
